< previous page page_359 next page >

Page 359
Next you can define the other blending functions in terms of B0,k(t).
e10a6a0a59f035e870d90cca05b85fce.gif
Bi,k(t) =       B0,k((t - i + N + 1) Mod (N + 1))
This makes each blending function look like a copy of B0,k(t) that has been shifted in the X direction. Figure 11.24 shows the blending functions for the curve drawn in Figure 11.23. To draw the entire curve using these functions, t must vary from 0 to N + 1.
In Visual Basic the Knot and Blend functions for the closed curve are:
e10a6a0a59f035e870d90cca05b85fce.gif
' Return the ith knot value.
Private Function Knot(ByVal i As Integer) As Integer
     Knot = i
End Function

' Recursively compute the blending function.
Private Function Blend(ByVal i As Integer, _
    ByVal k As Integer, ByVal t As Single) As Single
Dim numer As Single
Dim denom As Single
Dim value1 As Single
Dim value2 As Single
Dim newt As Single

    If i > 0 Then
        newt = t - i + MaxPt + 1
        Do While newt >= MaxPt + 1
            newt = newt - (MaxPt + 1)
        Loop
        Do While newt < 0
z0379-02.gif
Figure 11.24
Blending functions for the closed
B-spline shown in Figure 11.23.

 
< previous page page_359 next page >